#include "gtest/gtest.h"

#include "skiplist.h"

using namespace algo;

//add test
TEST(AddTest, HandlesAdd)
{
	SkipList<int, int> list;

	for (int i = 0; i < 4; ++i)
	{
		list.add(i, i*100);
	}

	bool flag = false;
	int val = 0;
	flag = list.get(3, val);
	
    EXPECT_EQ(flag && val == 300, true);
}

//add test
TEST(AddTest2, HandlesAdd)
{
	SkipList<int, int> list;

	for (int i = 0; i < 10; ++i)
	{
		list.add(i, i*100);
	}

	bool flag = false;
	int val = 0;
	flag = list.get(6, val);
	
    EXPECT_EQ(flag && val == 600, true);
}

//add test
TEST(AddTest3, HandlesAdd)
{
	SkipList<int, int> list;

	for (int i = 0; i < 10; ++i)
	{
		list.add(i, i*100);
	}

	bool flag = false;
	int val = 0;
	flag = list.get(9, val);
	
    EXPECT_EQ(flag && val == 900, true);
}

//add test
TEST(AddTest4, HandlesAdd)
{
	SkipList<int, int> list;

	for (int i = 0; i < 20; ++i)
	{
		list.add(i, i*100);
		// list.show_all();
		// std::cout << std::endl;
	}

	bool flag = false;
	int val = 0;
	flag = list.get(1, val);
	
    EXPECT_EQ(flag && val == 100, true);
}

//add test
TEST(AddTest5, HandlesAdd)
{
	SkipList<int, int> list;

	for (int i = 0; i < 20; ++i)
	{
		list.add(i, i*100);
		// list.show_all();
		// std::cout << std::endl;
	}

	bool flag = false;
	int val = 0;
	flag = list.get(5, val);
	
    EXPECT_EQ(flag && val == 500, true);
}

int main(int argc, char **argv)
{
	::testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
}